package com.shushan.util;

import android.content.Context;
import android.widget.Toast;

/**
 * @ClassName: ToastUtils
 * @Desciption: Toast工具类
 * @author: yichaohua
 * @date: 2017-12-29
 */
public class ToastUtils {

    private static Context context = null;
    private static Toast toast = null;

    public static void showToast(Context context, String text) {
        if (toast == null) {
            toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
        } else {
            toast.setText(text);
            toast.setDuration(Toast.LENGTH_SHORT);
        }
        toast.show();
    }

    public static void showToast(Context context, String text,int timeType) {
        if (toast == null) {
            toast = Toast.makeText(context, text, timeType);
        } else {
            toast.setText(text);
            toast.setDuration(timeType);
        }
        toast.show();
    }
}
